using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using THSLib;
using THSERP.BaseProvider;
using System.Data;
using THSERP.BusinessEntities;

namespace THSERP.Modules.Report
{
    public partial class ARRP004InvoiceItemBranchsGridControl : THSGridControl
    {
        protected override void AddColumnsToGridView(string strTableName, DevExpress.XtraGrid.Views.Grid.GridView gridView)
        {
            base.AddColumnsToGridView(strTableName, gridView);

            DevExpress.XtraGrid.Columns.GridColumn col = new DevExpress.XtraGrid.Columns.GridColumn();
            col.FieldName = "BRBranchName";
            col.Caption = "Branch";
            col.OptionsColumn.AllowEdit = false;
            gridView.Columns.Add(col);
        }

        protected override DevExpress.XtraGrid.Views.Grid.GridView InitializeGridView()
        {
            DevExpress.XtraGrid.Views.Grid.GridView gridView = base.InitializeGridView();
            gridView.OptionsView.ShowFooter = true;

            DevExpress.XtraGrid.Columns.GridColumn colCost = gridView.Columns["ARInvoiceItemTotalCost"];
            colCost.SummaryItem.FieldName = "ARInvoiceItemTotalCost";
            colCost.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
            colCost.SummaryItem.DisplayFormat = "{0:n2}";

            DevExpress.XtraGrid.Columns.GridColumn colNet = gridView.Columns["ARInvoiceItemNetAmount"];
            colNet.SummaryItem.FieldName = "ARInvoiceItemNetAmount";
            colNet.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
            colNet.SummaryItem.DisplayFormat = "{0:n2}";

            DevExpress.XtraGrid.Columns.GridColumn colQty = gridView.Columns["ARInvoiceItemProductQty"];
            colQty.SummaryItem.FieldName = "ARInvoiceItemProductQty";
            colQty.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
            colQty.SummaryItem.DisplayFormat = "{0:n2}";

            return gridView;
        }
    }
}
